/*
 * tele_data_transfer.c
 *
 *  Created on: 2023年2月28日
 *      Author: Lw
 */
#include "tele_data_transfer.h"
#include "pl_comm.h"
#include "camera_process.h"
#include "platform.h"
#include "update_firmware.h"
#include "sys_monitor.h"

extern volatile S_UTCTime s_tUTCTime;
extern S_PREP_PARAM s_Cam1PrepParam;
extern S_PREP_PARAM s_Cam2PrepParam;
extern S_tSysMonit s_SysMonit;
/*常规遥测项回传，定时查询*/
 void TeleRoutineStatusMsg(S_tCanData* dataBuff)
{
	u8 dataTemp;
	dataBuff->usSize = 0;
	dataBuff->uacData[dataBuff->usSize++] = (s_tUTCTime.TimeS >> 24);
	dataBuff->uacData[dataBuff->usSize++] = (s_tUTCTime.TimeS >> 16);
	dataBuff->uacData[dataBuff->usSize++] = (s_tUTCTime.TimeS >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_tUTCTime.TimeS;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.canTotalOrder >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.canTotalOrder;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.canCompleOrder >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.canCompleOrder;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.equipInitStatus;
	dataBuff->uacData[dataBuff->usSize++] = readPrepTemp();
	dataTemp = ReadPlLockedState();
	dataTemp |= (g_tEquipmentStatus.ucStartMode << 1);
	dataTemp |= (g_tEquipmentStatus.ucUpdateStatus << 4);
	dataBuff->uacData[dataBuff->usSize++] = dataTemp;
	dataTemp = 0;
	dataTemp = g_tEquipmentStatus.caliUseStatus;
	dataTemp |= (g_tEquipmentStatus.caliInitStatus << 4);
	dataBuff->uacData[dataBuff->usSize++] = dataTemp;
	dataTemp = 0;
	dataTemp = g_tEquipmentStatus.ucCamera_2_WorkMode;
	dataTemp |= (g_tEquipmentStatus.ucCamera_1_WorkMode << 3);
	dataTemp |= (g_tEquipmentStatus.ucCamera_2_status << 6);
	dataTemp |= (g_tEquipmentStatus.ucCamera_1_status << 7);
	dataBuff->uacData[dataBuff->usSize++] = dataTemp;
	dataBuff->uacData[dataBuff->usSize++] = ((g_tEquipmentStatus.uiCamera_1_ExposureTime/1000) >> 8) & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.uiCamera_1_ExposureTime/1000) & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_GainRGB;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.usCamera_1_GainEx >> 8) & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.usCamera_1_GainEx & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.usCamera_1_HGCLGC >> 8) & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.usCamera_1_HGCLGC & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_1_Offset >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_Offset;
	dataBuff->uacData[dataBuff->usSize++] = ((g_tEquipmentStatus.ucCamera_1_ShootTime/1000) >> 8) & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_1_ShootTime/1000) & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_1_ShootNum >> 8) & 0xff;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_ShootNum & 0xff;
    g_tEquipmentStatus.ucCamera_1_MoveTargetNum = ReadPlObjNum(1);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_1_MoveTargetNum >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_MoveTargetNum & 0xff;
    g_tEquipmentStatus.ucCamera_1_PlRecvPicNum = ReadPlRecvImageNum(1);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_1_PlRecvPicNum >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_PlRecvPicNum & 0xff;
    g_tEquipmentStatus.ucCamera_1_FinishedPicNum = ReadPlProcessNum(1);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_1_FinishedPicNum >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_FinishedPicNum & 0xff;
    g_tEquipmentStatus.ucCamera_1_DdrSavedPicNum = ReadPlDDRPicNum(1);
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_DdrSavedPicNum;
    g_tEquipmentStatus.ucCamera_1_SendPicNum = ReadPlSendImageNum(1);
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_SendPicNum;
    dataBuff->uacData[dataBuff->usSize++] = ((g_tEquipmentStatus.uiCamera_2_ExposureTime/1000) >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.uiCamera_2_ExposureTime/1000) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_GainRGB;
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.usCamera_2_GainEx >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.usCamera_2_GainEx & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.usCamera_2_HGCLGC >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.usCamera_2_HGCLGC & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_2_Offset >> 8);
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_Offset;
    dataBuff->uacData[dataBuff->usSize++] = ((g_tEquipmentStatus.ucCamera_2_ShootTime/1000) >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_2_ShootTime/1000) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_2_ShootNum >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_ShootNum & 0xff;
    g_tEquipmentStatus.ucCamera_2_MoveTargetNum = ReadPlObjNum(2);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_2_MoveTargetNum >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_MoveTargetNum & 0xff;
    g_tEquipmentStatus.ucCamera_2_PlRecvPicNum = ReadPlRecvImageNum(2);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_2_PlRecvPicNum >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_PlRecvPicNum & 0xff;
    g_tEquipmentStatus.ucCamera_2_FinishedPicNum = ReadPlProcessNum(2);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_2_FinishedPicNum >> 8) & 0xff;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_FinishedPicNum & 0xff;
    g_tEquipmentStatus.ucCamera_2_DdrSavedPicNum = ReadPlDDRPicNum(2);
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_DdrSavedPicNum;
    g_tEquipmentStatus.ucCamera_2_SendPicNum = ReadPlSendImageNum(2);
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_SendPicNum;
    g_tEquipmentStatus.cameraLvdsPackNum = ReadlvdsPackNum();
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.cameraLvdsPackNum >> 24);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.cameraLvdsPackNum >> 16);
    dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.cameraLvdsPackNum >> 8);
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.cameraLvdsPackNum;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.usCamera_1_CurrentTmp;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.usCamera_2_CurrentTmp;
	dataBuff->uacData[dataBuff->usSize++] = (s_SysMonit.SysResetTotalNum >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_SysMonit.SysResetTotalNum;
	dataBuff->uacData[dataBuff->usSize++] = (s_SysMonit.WdtResetCount >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_SysMonit.WdtResetCount;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_1_GainAnalog >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_1_GainAnalog;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.ucCamera_2_GainAnalog >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucCamera_2_GainAnalog;
	dataBuff->uacData[dataBuff->usSize++] = s_SysMonit.WdtEnable;
	dataBuff->uacData[dataBuff->usSize++] = s_SysMonit.WdtTimeOver;

}

/*在轨升级状态信息*/
void TeleFwStatusMsg(S_tCanData* dataBuff)
{
    checkFirmwareData();
    u8 packNum = 0;
	dataBuff->usSize = 0;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.FwLackPackageNum >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.FwLackPackageNum;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.updataFwPackageSeq >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.updataFwPackageSeq;
	for(packNum = 0; packNum < 90; packNum++)
	{
		dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.FwLackPackageSeq[packNum] >> 8);
		dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.FwLackPackageSeq[packNum];
	}
}
/*坏点MASK查询信息*/
void TeleMaskStatusMsg(S_tCanData* dataBuff)
{
    u8 packNum = 0;
    dataBuff->usSize = 0;
    for(packNum = 0; packNum < 9; packNum++) {
        dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.MaskInfo[packNum];
    }
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[0] >> 24;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[0] >> 16;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[0] >> 8;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[0];
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[1] >> 24;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[1] >> 16;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[1] >> 8;
    dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.DeadPixelNum[1];
}
/*预处理参数配置项查询*/
void TelePrepStatusMsg(S_tCanData* dataBuff)
{
	u8 dataTemp;
	dataBuff->usSize = 0;
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.yw2Version >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.yw2Version;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ledBrightness;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucMotor_1_Angle;
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.ucMotor_2_Angle;
	dataTemp = 0;

	s_Cam1PrepParam.Flat_Dark_process_en =  Read_Flat_Dark_process(1);
	s_Cam2PrepParam.Flat_Dark_process_en =  Read_Flat_Dark_process(2);
	s_Cam1PrepParam.block_size_0 =  Read_block_size_0(1);
	s_Cam2PrepParam.block_size_0 =  Read_block_size_0(2);
	s_Cam1PrepParam.block_size_1 =  Read_block_size_1(1);
	s_Cam2PrepParam.block_size_1 =  Read_block_size_1(2);
	s_Cam1PrepParam.blcok0_Nmax0 =  Read_blcok0_Nmax0(1);
	s_Cam2PrepParam.blcok0_Nmax0 =  Read_blcok0_Nmax0(2);
	s_Cam1PrepParam.blcok1_Nmax1 = Read_blcok1_Nmax1(1);
	s_Cam2PrepParam.blcok1_Nmax1 = Read_blcok1_Nmax1(2);
	s_Cam1PrepParam.blcok_Nmin =  Read_blcok_Nmin(1);
	s_Cam2PrepParam.blcok_Nmin =  Read_blcok_Nmin(2);
	s_Cam1PrepParam.corner_cnt  = Read_corner_cnt(1);
	s_Cam2PrepParam.corner_cnt  = Read_corner_cnt(2);
	s_Cam1PrepParam.atomosphere_thresh = Read_atomosphere_thresh(1);
	s_Cam2PrepParam.atomosphere_thresh = Read_atomosphere_thresh(2);
	s_Cam1PrepParam.max_cfs_npix = Read_max_cfs_npix(1);
	s_Cam2PrepParam.max_cfs_npix = Read_max_cfs_npix(2);
	s_Cam1PrepParam.binarized_thresh = Read_binarized_thresh(1);
	s_Cam2PrepParam.binarized_thresh = Read_binarized_thresh(2);
	s_Cam1PrepParam.saturated_thresh = Read_saturated_thresh(1);
	s_Cam2PrepParam.saturated_thresh = Read_saturated_thresh(2);
	s_Cam1PrepParam.object_thresh = Read_object_thresh(1);
	s_Cam2PrepParam.object_thresh = Read_object_thresh(2);
	s_Cam1PrepParam.min_streak_npix = Read_min_streak_npix(1);
	s_Cam2PrepParam.min_streak_npix = Read_min_streak_npix(2);
	s_Cam1PrepParam.max_streak_npix = Read_max_streak_npix(1);
	s_Cam2PrepParam.max_streak_npix = Read_max_streak_npix(2);
	s_Cam1PrepParam.porosity_grade = Read_porosity_grade(1);
	s_Cam2PrepParam.porosity_grade = Read_porosity_grade(2);
	s_Cam1PrepParam.Target_detection_num = Read_Target_detection_num(1);
	s_Cam2PrepParam.Target_detection_num = Read_Target_detection_num(2);
	s_Cam1PrepParam.sub_filtering_en = Read_sub_filtering_en(1);
	s_Cam2PrepParam.sub_filtering_en = Read_sub_filtering_en(2);
	s_Cam1PrepParam.atomosphere_mask_en = Read_atomosphere_mask_en(1);
	s_Cam2PrepParam.atomosphere_mask_en = Read_atomosphere_mask_en(2);
	s_Cam1PrepParam.fill_defect_mask_en = Read_fill_defect_mask_en(1);
	s_Cam2PrepParam.fill_defect_mask_en = Read_fill_defect_mask_en(2);
	s_Cam1PrepParam.bright_region_thresh = Read_bright_region_thresh(1);
	s_Cam2PrepParam.bright_region_thresh = Read_bright_region_thresh(2);
	s_Cam1PrepParam.flat_dark_dn_offset = Read_flat_dark_dn_offset(1);
	s_Cam2PrepParam.flat_dark_dn_offset = Read_flat_dark_dn_offset(2);
	s_Cam1PrepParam.sita3_value = Read_3sita_value(1);
	s_Cam2PrepParam.sita3_value = Read_3sita_value(2);
	s_Cam1PrepParam.cali_norm_value = Read_cali_norm_value(1);
	s_Cam2PrepParam.cali_norm_value = Read_cali_norm_value(2);
	s_Cam1PrepParam.scale_factor = Read_scale_factor(1);
	s_Cam2PrepParam.scale_factor = Read_scale_factor(2);
	s_Cam1PrepParam.length_width_ratio = Read_length_width_ratio(1);
	s_Cam2PrepParam.length_width_ratio = Read_length_width_ratio(2);
	s_Cam1PrepParam.corr_coef_thresh0 = Read_corr_coef_thresh0(1);
	s_Cam2PrepParam.corr_coef_thresh0 = Read_corr_coef_thresh0(2);
	s_Cam1PrepParam.corr_coef_thresh1 = Read_corr_coef_thresh1(1);
	s_Cam2PrepParam.corr_coef_thresh1 = Read_corr_coef_thresh1(2);


	dataTemp = s_Cam2PrepParam.Flat_Dark_process_en;
	dataTemp |= (s_Cam2PrepParam.fill_defect_mask_en << 1);
	dataTemp |= (s_Cam2PrepParam.atomosphere_mask_en << 2);
	dataTemp |= (s_Cam2PrepParam.sub_filtering_en << 3);
	dataTemp |= (s_Cam1PrepParam.Flat_Dark_process_en << 4);
	dataTemp |= (s_Cam1PrepParam.fill_defect_mask_en << 5);
	dataTemp |= (s_Cam1PrepParam.atomosphere_mask_en << 6);
	dataTemp |= (s_Cam1PrepParam.sub_filtering_en << 7);
	dataBuff->uacData[dataBuff->usSize++] = dataTemp;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.block_size_0 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.block_size_0;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.block_size_1 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.block_size_1;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.blcok0_Nmax0 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.blcok0_Nmax0;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.blcok1_Nmax1 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.blcok1_Nmax1;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.blcok_Nmin >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.blcok_Nmin;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.corner_cnt >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.corner_cnt;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.atomosphere_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.atomosphere_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.max_cfs_npix >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.max_cfs_npix;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.binarized_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.binarized_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.saturated_thresh >> 24);
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.saturated_thresh >> 16);
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.saturated_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.saturated_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.object_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.object_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.min_streak_npix >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.min_streak_npix;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.max_streak_npix >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.max_streak_npix;
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.porosity_grade;
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.Target_detection_num;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.bright_region_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.bright_region_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.sita3_value >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.sita3_value;

	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.block_size_0 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.block_size_0;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.block_size_1 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.block_size_1;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.blcok0_Nmax0 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.blcok0_Nmax0;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.blcok1_Nmax1 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.blcok1_Nmax1;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.blcok_Nmin >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.blcok_Nmin;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.corner_cnt >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.corner_cnt;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.atomosphere_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.atomosphere_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.max_cfs_npix >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.max_cfs_npix;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.binarized_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.binarized_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.saturated_thresh >> 24);
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.saturated_thresh >> 16);
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.saturated_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.saturated_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.object_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.object_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.min_streak_npix >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.min_streak_npix;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.max_streak_npix >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.max_streak_npix;
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.porosity_grade;
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.Target_detection_num;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.bright_region_thresh >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.bright_region_thresh;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.sita3_value >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.sita3_value;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.flat_dark_dn_offset >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.flat_dark_dn_offset;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.flat_dark_dn_offset >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.flat_dark_dn_offset;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.cali_norm_value >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.cali_norm_value;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.cali_norm_value >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.cali_norm_value;
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.scale_factor;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.length_width_ratio >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.length_width_ratio;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.corr_coef_thresh0 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.corr_coef_thresh0;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam1PrepParam.corr_coef_thresh1 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam1PrepParam.corr_coef_thresh1;
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.scale_factor;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.length_width_ratio >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.length_width_ratio;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.corr_coef_thresh0 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.corr_coef_thresh0;
	dataBuff->uacData[dataBuff->usSize++] = (s_Cam2PrepParam.corr_coef_thresh1 >> 8);
	dataBuff->uacData[dataBuff->usSize++] = s_Cam2PrepParam.corr_coef_thresh1;
	g_tEquipmentStatus.pl_1_status = Read_pl_run_status(1);
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.pl_1_status >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.pl_1_status;
	g_tEquipmentStatus.pl_2_status = Read_pl_run_status(2);
	dataBuff->uacData[dataBuff->usSize++] = (g_tEquipmentStatus.pl_2_status >> 8);
	dataBuff->uacData[dataBuff->usSize++] = g_tEquipmentStatus.pl_2_status;
}

